package webapp.frontOffice.servlet;

import java.io.IOException;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import modele.gestionVente.Enchere;
import modele.gestionVente.VenteDirecte;
import dao.gestionVente.EnchereDAO;
import dao.gestionVente.VenteDirecteDAO;

/**
 * Servlet implementation class Offre
 */
@WebServlet("/offre/liste")
public class Offre extends HttpServlet {
	private static final long serialVersionUID = 1L;

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
	{
		List<Enchere> encheres = new EnchereDAO().retrieveActive();
		List<VenteDirecte> ventes = new VenteDirecteDAO().retrieveActive();
		
		request.setAttribute("ventes", ventes);
		request.setAttribute("encheres", encheres);
		
		RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/viewFrontoffice/offreliste.jsp");
		dispatcher.forward(request, response);
	}

}
